from pytest import param
import requests

img_path = './pre_do&knn/data/chi/1_0.png'

img_file = open(img_path, 'rb')
files = {'file': img_file}
headers = {
    'cookies': 'mk=m404654hfaiudhauifhui',
    'referer': '127.0.0.1',
    'user-agent': 'spider.com',
}
data = {'sessionid': 'm130fdahsdfhaksf'}
params = {'mk': 'dsfa45456asf4d6a'}
while True:
    a = eval(input('请输入：1-2-3\n'))
    if a == 1:
        res = requests.get('http://127.0.0.1:8000/index',
                        #    files=files,
                           params=params,
                           headers=headers,
                        #    data=data
                        )
    elif a == 2:
        res = requests.post('http://127.0.0.1:8000/spider',
                            params=params,
                            # data=data,
                            headers=headers,
                            # files=files
                            )
    elif a == 3:
        break
